package com.xxx.file;

import com.sun.org.apache.bcel.internal.generic.NEW;

import java.io.*;
import java.nio.charset.StandardCharsets;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/7/22  14:59
 * @Copyright
 */
public class FiliOutDmoe {
    public static void main(String[] args) {

       // m1();
        try(
                FileInputStream stream = new FileInputStream("a.txt")

        ) {
            byte[] b = new byte[1024];
             int read =0;
            while ((read = stream.read(b)) != -1){
                System.out.println(new String(b,0,read));

            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    private static void m1() {
        try(
                FileOutputStream fileOutputStream = new FileOutputStream("a.txt")

                ) {
            //getBytes()转字节
            fileOutputStream.write("666哇".getBytes(StandardCharsets.UTF_8));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
